package 每日一题;

/**
 * @author chenhong
 * @version 1.0.0
 * @ClassName L2373.java
 * @createTime 2023年03月01日 16:49:00
 */
public class L2373 {
}

class Solution2373 {
    public int[][] largestLocal(int[][] grid) {
        int n = grid.length;
        int[][] res = new int[n - 2][n - 2];
        for (int i = 0; i < res.length; i++) {
            for (int j = 0; j < res[0].length; j++) {
                res[i][j] = maxGrid(grid,i,j);
            }
        }
        return res;
    }

    public int maxGrid(int[][] grid, int startI, int startJ) {
        int num = 0;
        for (int i = startI; i < startI + 3; i++) {
            for (int j = startJ; j < startJ + 3; j++) {
                num = Math.max(num, grid[i][j]);
            }
        }
        return num;
    }

}